home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 352_01 / wildfile.cpp < prev    next >
C/C++ Source or Header  |  1991-04-22  |  739b  |  34 lines

  1. // WILDPP.CPP    generate a Vlist of file names from a wildcard.
  2. //                 PARM: spec = ptr to filename wildcards. Includes path
  3. //                      attr = file attribute mask, see TurboC++ findfirst()
  4. //                RETURNS: ptr to a new Vlist, or empty list if not found.
  5. #include <stdlib.h>
  6. #include <dir.h>
  7. #include <dos.h>
  8. #include <string.h>
  9.  
  10. #include "wtwg.h"
  11.  
  12.  
  13. #include "dblib.h"
  14.  
  15. Vlist  *wildfile ( char * wc, int file_attr )
  16.     {
  17.     char far *dta;
  18.     struct ffblk ffb;
  19.     int done;
  20.     Vlist *vl = new Vlist;
  21.  
  22.     dta = getdta();
  23.     for (done= findfirst (wc,&ffb,file_attr); !done;    done= findnext (&ffb) )
  24.             {
  25.             vl->push ( ffb.ff_name );
  26.             }
  27.     setdta (dta);
  28.     return (vl);        // wildfile_pp
  29.     }
  30.     
  31.     
  32.  
  33. //----------------- end of WILDFILE.CPP
  34.